﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace MVVM_Wrapper_Test {
   public class Person : INotifyPropertyChanged{

      private String _name;

      /// <summary>
      /// Gets and sets the Name property
      /// </summary>
      public String Name {
         get { return _name; }
         set {
            if (_name == value) { }
            else {
               _name = value;
               NotifyPropertyChanged("Name");
            }
         }
      }
      
      private int _age;

      /// <summary>
      /// Gets and sets the Age property
      /// </summary>
      public int Age {
         get { return _age; }
         set {
            if (_age == value) { }
            else {
               _age = value;
               NotifyPropertyChanged("Age");
            }
         }
      }

      #region INotifyPropertyChanged Members

      /// <summary>
      /// Property Changed event
      /// </summary>
      public event PropertyChangedEventHandler PropertyChanged;

      /// <summary>
      /// Standard NotifyPropertyChanged Method, Override if you need to do special handling in your class
      /// </summary>
      /// <param name="propertyName">Property Name</param>
      private void NotifyPropertyChanged(string propertyName) {
         if (PropertyChanged != null) {
            PropertyChanged(this,
              new PropertyChangedEventArgs(propertyName));
         }
      }

      #endregion
   }
}
